from flask import Flask,render_template

import config
from apps.cms.views import cms_route
from apps.common.views import common_route
from apps.front.views import front_route
from apps.ueditor.ueditor import bp
from exts import db,csrf,mail
from custom_templates_filter import time_format






def create_app():
    app = Flask(__name__)
    app.config.from_object(config)

    app.register_blueprint(cms_route)
    app.register_blueprint(common_route)
    app.register_blueprint(front_route)
    app.register_blueprint(bp)

    db.init_app(app)

    app.jinja_env.filters['time_format']= time_format
    csrf.init_app(app)
    mail.init_app(app)

    return app





if __name__ == '__main__':
    app = create_app()
    app.run(host='0.0.0.0', port=8000)
